package com.iv.durian.cloud.facade;

import com.iv.durian.cloud.Lesson;
import com.iv.durian.cloud.Serve;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * Created by zlw on 2018-06-30.
 */

@Component
@FeignClient(name = Serve.SERVICE_NAME)
@RequestMapping("/service/lesson")
public interface LessonFacade {

    @RequestMapping(path = "/getById/{lesson_id}", method = RequestMethod.GET)
    Lesson getById(@PathVariable(value = "lesson_id") Integer lessonId);

    @RequestMapping(path = "/getByName/{lesson_name}", method = RequestMethod.GET)
    Lesson getByName(@PathVariable(value = "lesson_name") String lessonName);

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    void add(@RequestBody Lesson lesson);

    @RequestMapping(value = "/removeLessonById/{lesson_id}", method = RequestMethod.POST)
    void removeById(@PathVariable("lesson_id") Integer id);

    @RequestMapping(value = "/removeLessonByName/{lesson_name}", method = RequestMethod.POST)
    void removeByName(@PathVariable("lesson_name") String name);

    @RequestMapping(value = "/updateLesson/{lesson_id}/{lesson_name}", method = RequestMethod.POST)
    int updateLessonName(@PathVariable("lesson_id") Integer id, @PathVariable("lesson_name") String lessonName);

    @RequestMapping(value = "/listLesson/{status}/{offset}/{limit}", method = RequestMethod.GET)
    List<Lesson> list(@PathVariable("status") Integer status, @PathVariable("offset") Integer offset, @PathVariable("limit") Integer limit);

    @RequestMapping(value = "/countLesson/{status}", method = RequestMethod.GET)
    int count(@PathVariable("status") Integer status);


}
